<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>微信JS-SDK Demo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
  <link rel="stylesheet" href="style.css">
</head>
<body ontouchstart="">

<div class="wxapi_container">
    <div class="wxapi_index_container">
      <ul class="label_box lbox_close wxapi_index_list">
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-voice">音频接口</a></li>
      </ul>
    </div>
    <div class="lbox_close wxapi_form">
    
      <h3 id="menu-voice">音频接口</h3>
      <span class="desc">开始录音接口</span>
      <button class="btn btn_primary" id="startRecord">startRecord</button>
      <span class="desc">停止录音接口</span>
      <button class="btn btn_primary" id="stopRecord">stopRecord</button>
      <span class="desc">播放语音接口</span>
      <button class="btn btn_primary" id="playVoice">playVoice</button>
      <span class="desc">暂停播放接口</span>
      <button class="btn btn_primary" id="pauseVoice">pauseVoice</button>
      <span class="desc">停止播放接口</span>
      <button class="btn btn_primary" id="stopVoice">stopVoice</button>
      <span class="desc">上传语音接口</span>
      <button class="btn btn_primary" id="uploadVoice">uploadVoice</button>
      <span class="desc">下载语音接口</span>
      <button class="btn btn_primary" id="downloadVoice">downloadVoice</button>
    </div>
  </div>
</body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script>
	var timestamp;
	var appId;
	var signature;
	var nonceStr;
	$.ajax({
	    type: "GET",
	    url: "http://wx.ngrok.chenwenxi.cc/wx/portal/wxddd28123dd40b31d/a",
	    dataType: "json",
	    success: function(data){
	    	console.log("数据返回:"+data.appId);
	    	timestamp= data.timestamp;
	    	appId = data.appId;
	    	signature = data.signature;
	    	nonceStr = data.nonceStr;
	    	
	    	wx.config({
	    	      debug: false,
	    	      appId: appId,
	    	      timestamp: timestamp,
	    	      nonceStr: nonceStr,
	    	      signature: signature,
	    	      jsApiList: [
	    	        'checkJsApi',
	    	        'translateVoice',
	    	        'startRecord',
	    	        'stopRecord',
	    	        'onRecordEnd',
	    	        'playVoice',
	    	        'pauseVoice',
	    	        'stopVoice',
	    	        'uploadVoice',
	    	        'downloadVoice'
	    	      ]
	    	  });
	    }
	});
	
  
</script>
<script src="api-yqr.js"> </script>
</html>
